    layui.use(['element','layer'], function () {
        var element = layui.element;
        var layer = layui.layer;
    });

    //获取登录信息
    var c = document.cookie;
    if (c != "") {
        var arrayCookie = c.split("; ");
        var k = arrayCookie[arrayCookie.length-1].split("=");
        $("#username").val(k[0]);
        $("#password").val(k[1]);
    }

    //设置cookie
    function setCookie(username,password,days){
        var d = new Date();
        d.setTime(d.getTime()+(days * 24 * 60 * 60 * 1000));
        var expires = "expires="+d.toGMTString();
        document.cookie = username + "=" + password + ";" + expires + ";path=/";
    }

    $(function()
        {
            getYanzm();//页面一进来就加载一次验证码
        }
    );

    $(".yzm_div").click
    (
        function ()
        {
            getYanzm();//点击调用验证码
        }
    )

    var uuid = '';
    function getYanzm()
    {
        //发送登录请求
        $.ajax
        (
            {
                url:"/videoWeb/captcha",
                type:"get",
                data:
                    {

                    },
                success:function(res)
                {
                    uuid = res.uuid;
                    $("#yzm_img").attr("src","data:img/png;base64," + res.img);
                }
            }
        )
    }

    //登录
    $(".login_body_div1_div2_loginInput").click(function(){
        var username = $("#username").val();
        var password = $("#password").val();
        var code = $("#yzm_input").val();
        // var rememberPassword = document.getElementById("rememberPassword").checked;
        var rememberPassword = $("#rememberPassword").prop("checked");

        if(username == '' || username == null){
            layer.msg("请输入用户名!",{icon:7});
            return false;
        }
        if(password== '' || password == null){
            layer.msg("请输入密码!",{icon:7});
            return false;
        }
        if(code== '' || code == null){
            layer.msg("请输入验证码!",{icon:7});
            return false;
        }

        //记住密码
        if(rememberPassword == true){
            var co = document.cookie;
            if (co != "") {
                var arrayCookie = c.split("; ");
                for (var i = 0; i < arrayCookie.length; i++) {
                    var k = arrayCookie[i].split("=");
                    setCookie(k[0],k[1],-1);
                }
            }
            setCookie(username,password,7);
        }

        //发送登录请求
        $.ajax({
            url:"/videoWeb/login",
            type:"POST",
            data:
            {
                username:username,
                password:password,
                code:code,
                uuid:uuid,
            },
            success:function(res)
            {
                if(res.code == 100)
                {
                    localStorage.Authorization = res.Authorization;
                    location.href="../../../../../../fronts/index.html";
                }
                else if(res.code == 104)
                {
                    layer.msg("用户名或密码错误!",{icon:7});
                }
                else if(res.code == 500)
                {
                    getYanzm();
                    layer.msg(res.message,{icon:7});
                }
            }
        })

    })
